<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="<%=application.getContextPath() %>/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-1.6.min.js"></script>	
<script language="javascript" src="<%=application.getContextPath() %>/js/calendar_eu.js"></script>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery-ui-1.8.17.custom.css"/>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>

<script type="text/javascript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>

<script>
	$(document).ready(function(){
	$('#exeName').live('focusin',function(){
	var orlist=$("#exelist").val();
	
	var temp=orlist.split("/");
	//alert(temp);
		$("#exeName").autocomplete({
			source: temp
		});
		jQuery('.ui-autocomplete').css({'font-size':'10px','font-family':'Arial','max-height': '100px',
	'overflow-y': 'auto', 'padding-right': '20px', 'overflow-x': 'hidden'});
	
	});
	});
	
</script>
<script>
  $(document).ready(function(){
    $("#myform").validate({
  messages: {
	  exeName:
      {
          required: "Executive Name must not be empty.",
      },
      exeEmail:
      {
          required: "Email must not be empty.",
          email: "Invalid Email Id",
      },
      exePass:
      {
          required: "Password must not be empty.",
          
      },
      exeCrDate:
      {
          required: "Created Date must not be empty.",
          
      },
      exePhone:
      {
          required: "Phone must not be empty.",
          
      }
      
   
  }
});
  });
</script>
</head>
<style>
	#field, label { float: left; font-family: Arial, Helvetica, sans-serif; font-size: 11px; }
  	label {  width: 14em; }
	br { clear: both; }
	input.error { border: 1px solid red;  }
	select.error{ border: 1px solid red;  }
	label.error {
		padding-left: 16px;
		margin-left: .3em;
		color: red;
		
	}
	#editor{
	width:95%;
	}
	#remarksEditor{
	width:95%;
	}
	#nextsteppopup {
	position:absolute;
  z-index:200; /* aaaalways on top*/
  padding: 3px;
 
  width: 250px;
  color: white;
	}
	.ui-dialog .ui-state-error { padding: .3em; }
	.ui-corner-all{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
	}
	.ui-corner-all:hover{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-weight: normal;
	color: #666666;
	text-decoration: none;
	}
	.logout{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11px;
	height: 15px;
	width: 50px;
	font-weight: normal;
	color: red;
	text-decoration: none;
	}
	#bulletinDialog title{
	font-family:Arial, Helvetica, sans-serif;
	font-size:14px;
	font-weight:bold;
	}
	.textarea1{
		height: 50px;
	}
	td input{
	width: 15%;
	}
	</style>

    <script>

	$(function() {
		$( "#exeCrDate" ).datepicker({ dateFormat: "dd-mm-yy" });
	});
	</script>
<body onLoad="MM_preloadImages('<%=application.getContextPath() %>/images/travel-hover.jpg','<%=application.getContextPath() %>/images/os-hover.jpg')">
<form action="<%=application.getContextPath() %>/exeRegistration/save.do" method="post" name="myform" id="myform">
<table width="927" style="height: 880px" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="116" align="left" valign="top" background="<%=application.getContextPath() %>/images/top-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
    <%@ include file="../common/exe-header.jsp" %>
	</td>
  </tr>
  <tr>
    <td align="left" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<tr>
    		<td align="left" valign="top">&nbsp;&nbsp;
    			<a href="<%=application.getContextPath() %>/user/open.do"><img src="<%=application.getContextPath() %>/images/home1.jpg" width="20" height="20" border="0" /></a>
    		</td>
    	<td align="center" valign="top">
    	<%
        	if(request.getParameter("success")!=null){
        		out.println(request.getParameter("success"));
        	}
        %>
    	</td>
    		<td width="8%" align="center"><a href="<%=application.getContextPath() %>/user/logout.do" style="font-family: sans-serif;">&nbsp;&nbsp;Logout</a></td>
    	</tr>
    	
    </table>
    </td>
  </tr>
 
  <tr>
    <td height="600" align="left" valign="top">
    <table width="98%" align="center" height="298" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="100%" align="center" valign="top">
        <table width="100%" height="625" cellpadding="0" cellspacing="0" class="box-border1">
          <tr>
            
            <td width="99%" align="left" valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="20"  align="center" valign="middle" style="background:url(<%=application.getContextPath() %>/images/hed-bg-block.jpg); background-repeat:repeat-x" class="hed2"><strong>Executive Registration</strong></td>
              </tr>
              <tr>
                <td height="20" align="center"  class="icon-header2"></td>
              </tr>
              
              <tr>
                <td height="20"  align="left"  class="icon-header2">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 <tr>
              		<td>
                	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                   
                <tr>
                <td height="10" align="right" bgcolor="#ffffff" class="hed-blc"></td>
                <td></td>
                <td ></td>
                <td ></td>
                <td width="176"></td>
                <td width="10"></td>
                <td width="178"></td>
                <td width="166"></td>
                </tr>
              
              <tr>
                <td height="10" align="right" bgcolor="#ffffff" class="hed-blc"></td>
                <td></td>
                <td ></td>
                <td ></td>
                <td width="176"></td>
                <td width="10"></td>
                <td width="178"></td>
                <td width="166"></td>
                </tr>
              <tr>
                <td height="21" width="193" align="right" bgcolor="#ffffff"  class="hed-blc">Name:</td>
                <td>&nbsp;</td>
                <td><input name="exeName" type="text" class="textfield required" id="exeName"  tabindex="1" /></td>
                <td>&nbsp;</td>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc">Permanent Address:</td>
                <td>&nbsp;</td>
                <td rowspan="3">
					<textarea  name="permaddress" id="permaddress" class="textarea1" tabindex="2"></textarea>                

                </td>
                <td width="166"></td>
              </tr>
              
              <tr>
                <td height="10" align="right" class="hed-blc" ></td>
                <td></td>
                <td ></td>
                <td ></td>
                <td width="176"></td>
                <td width="10"></td>
                <td width="166"></td>
              </tr>
              <tr >
                <td width="193" height="20" align="right"  class="hed-blc">Email:</td>
                <td width="10" >&nbsp;</td>
                <td width="169" >
                  <input name="exeEmail" type="text" class="textfield required email" id="exeEmail"  tabindex="3" onblur="javascript: emailValidate2()"/>
                </td>
                <td width="10" >&nbsp;</td>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc"></td>
                <td>&nbsp;</td>
                <td width="166"></td>
              </tr>
              
              <tr>
                <td height="10" align="right" bgcolor="#ffffff" class="hed-blc"></td>
                <td></td>
                <td ></td>
                <td ></td>
                <td width="176"></td>
                <td width="10"></td>
                <td width="178"></td>
                <td width="166"></td>
              </tr>
              <tr>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc">Password:</td>
                <td>&nbsp;</td>
                <td><input name="exePass" type="text" class="textfield required" id="exePass" tabindex="4"/></td>
                <td>&nbsp;</td>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc">Present Address:</td>
                <td>&nbsp;</td>
                <td rowspan="3">
					<textarea  name="presaddress" id="presaddress" class="textarea1" tabindex="5"></textarea>                

                </td>
                <td width="166"></td>
              </tr>
              <tr>
                <td height="10" align="right" bgcolor="#ffffff" class="hed-blc"></td>
                <td></td>
                <td ></td>
                <td ></td>
                
                <td width="10"></td>
                <td ></td>
                <td width="166"></td>
              </tr>
              <tr>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc">Gender:</td>
                <td>&nbsp;</td>
                <td>
                Male
                <input name="exeGender" type="radio"  id="male" value="Male" tabindex="6"/>
                Female
                <input name="exeGender" type="radio"  id="female" value="Female"  tabindex="7"/>
                </td>
                <td ></td>
                <td width="176"></td>
                <td width="10"></td>
                <td width="166"></td>
              </tr>
              <tr>
                <td height="10" align="right" bgcolor="#ffffff" class="hed-blc"></td>
                <td></td>
                <td ></td>
                <td ></td>
                <td width="176"></td>
                <td width="10"></td>
                <td ></td>
                <td width="166"></td>
              </tr>
              <tr>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc">Phone:</td>
                <td>&nbsp;</td>
                <td>
                <input name="exePhone" type="text" class="textfield required" id="exePhone"  tabindex="8"/>
                </td>
                <td>&nbsp;</td>
                <td height="21" align="right" bgcolor="#ffffff"  class="hed-blc">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td width="166"></td>
              </tr>
                    
                    </table>
                </td>
              </tr>
                </table>
                </td>
              </tr>
              
                </table>
                </td>
              </tr>
              
              
              <tr>
                <td height="10">&nbsp; </td>
                
              </tr>
              <tr>
                <td height="10">&nbsp; </td>
                
              </tr>
              <tr>
                <td height="10">
                <table width="906">
                <tr>
                <td width="72%"><input type="hidden" id="exelist" value="<%=request.getAttribute("exelist")%>"/></td>
                <td width="7%" align="center"><input type="button" id="edit" value="Edit" class="button-black" onclick="javascript: retriveExec()"/></td>
                <td width="7%" align="center"><input type="button" class="button-black" value="Save" tabindex="9" onClick="javascript:return emailValidate();"/></td>
                <td width="7%" align="center"><input type="reset" class="button-black" value="Clear" tabindex="10"/></td>
               
                <td width="2%">&nbsp;
                    <input type="hidden" id="orglist" value="<%=request.getAttribute("orglist")%>"/>
                </td>
                	<td width="5%" >&nbsp;&nbsp; </td>
                </tr>
                </table></td>
                
              </tr>
              
            </table></td>
          </tr>
        </table>
        </td>
  </tr>
  
  <tr>
        <td>&nbsp; </td>
        </tr>
        <tr>
        <td>&nbsp; </td>
        </tr>
        <tr>
        <td>&nbsp; </td>
        </tr>
        <tr>
    <td height="40" align="left" valign="top" bgcolor="#0B0B0B">&nbsp;</td>
  </tr>
</table></form>
<div id="bulletinDialog" style="display: none;">
                  <div id="execSearchBox">
           <form action="<%= application.getContextPath()%>/exeRegistration/getExeDetails.do" method="post">
           			   <br />
                    <select name="execName" class="form" id="exect">
               			 <option value="Please Select">Please Select</option>
                   </select>
                  	<br />
                  	<br />
                    <input class="button-right" type="submit" id="ok" value="OK"/> 
                    </form>
                    </div>
                    
        </div>
</body>
</html>
<script type="text/javascript">
function emailValidate2(){
	var email=$("#exeEmail").val();
	var data="email="+email;
	$.ajax({
		url:"<%=application.getContextPath() %>/exeRegistration/emailValidate.do",
		method:"post",
		cache: false,
		data: data,
		success: function(res){
			if(res=="false"){
				jAlert("Email Id is not Available");
				return false;
			}
			
		}
	});
}
</script> 
<script type="text/javascript">
function emailValidate(){
	var email=$("#exeEmail").val();
	var data="email="+email;
	var exeName=$("#exeName").val();
	
	$.ajax({
		url:"<%=application.getContextPath() %>/exeRegistration/emailValidate.do",
		method:"post",
		cache: false,
		data: data,
		success: function(res){
			if(res=="false"){
				jAlert("Email Id is not Available");
				return false;
			}
			else{
				$("#myform").submit();
			}
		}
	});
}
</script>

<script  type="text/javascript">
function retriveExec(){
	
	$.ajax({
		url:" <%=application.getContextPath()%>/exeRegistration/getExec.do",
		mimetype: "text/plain",
		cache:false,
		success: function(res){
			var e2=document.getElementById('exect');
			$('#exect')
		    .find('option')
		    .remove()
		    .end()
		   	;
			var temp=res.split(",");
			var o=document.createElement('option');
			o.value="Please Select";
			o.text="Please Select";
			e2.options.add(o);
			if(temp != null){
				for(var i=0;i<temp.length-1;i++){
					var o=document.createElement('option');
					o.value=temp[i];
					o.text=temp[i];
					e2.options.add(o);
				}
			}
			//$("#clientSearchBox").html(res);
			
		}

	});

var $dialog = $('#bulletinDialog').dialog({
                autoOpen: false,
                modal: true,
                width: 250,
                height: 120,
              				
            });
 			 
            $dialog.dialog('open');
}
</script>